<script>
	export default {
		onLaunch: function() {},
		onShow: function() {
			let that = this;
			//获取用户信息，如果没有说明，没有登录
			try {
				that.globalData.token = uni.getStorageSync(that.globalData.storageTokenKey);
				that.globalData.user = uni.getStorageSync(that.globalData.storageUserKey);
				that.globalData.userId = that.globalData.user.id;
				if (that.globalData.token === '' ||
					that.globalData.user === '' ||
					that.globalData.userId < 1
				) {
					uni.reLaunch({
						url: '/pages/login/login'
					})
				}
			} catch (e) {
				console.log('没有用户数据');
				uni.reLaunch({
					url: '/pages/login/login'
				})
			}
		},
		onHide: function() {},
		onError(error) {},
		globalData: {
			storageUserKey: 'storageUserKey',
			storageTokenKey: 'storageTokenKey',
			token: '',
			userId: 0,
			user: null
		},
	}
</script>

<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";
	@import url("static/style/bootstrap3.css");
	/* 字体图标 */
	@import url("static/style/font-awesome.css");

	.row {
		margin-left: 0;
		margin-right: 0;
	}

	.fa-spin-1 {
		-webkit-animation: fa-spin 1s infinite linear;
		animation: fa-spin 1s infinite linear
	}

	.fa-spin-0-5 {
		-webkit-animation: fa-spin 0.5s infinite linear;
		animation: fa-spin 0.5s infinite linear
	}

	page {
		font-size: 32rpx;
	}

	.btn {
		font-size: 32rpx;
	}

	.form-control {
		font-size: 32rpx;
	}

	text {
		font-size: 32rpx;
	}
</style>
